package com.luojing.innerclass;

/**
 * 内部类可以用this 来获得外部类的引用
 * @author luojing
 * @create 2018/09/08 上午10:35
 **/
public class DoSometing {
  private String name;
  public void f(String a){
    System.out.println(name);
  }

  private class InnerClaz{

    public DoSometing print(String s){
      return DoSometing.this;
    }

  }

  public InnerClaz getInner(){
    return new InnerClaz();
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public static void main(String[] args) {
    DoSometing someting = new DoSometing();
    someting.setName("abc");
    InnerClaz innerClaz = someting.getInner();
    innerClaz.print("a").f("a");
  }
}
